package com.yc.shadowdemo

import android.app.Application
import android.os.Process
import android.util.Log
import com.yc.commontlib.HostProviderTest
import com.yc.commontlib.YcJetpack
import com.yc.commontlib.test.HostProviderTest2
import com.yc.shadowdemo.demo.UrlHelper
import com.yc.shadowdemo.plugin.YcPluginInit
import java.io.File

/**
 * Creator: yc
 * Date: 2021/6/1 15:27
 * UseDes:
 */
class App : Application() {
    companion object {
        lateinit var mInstant: App
            private set
    }

    override fun onCreate() {
        super.onCreate()
//        Thread.setDefaultUncaughtExceptionHandler(MyUncaughtExceptionHandler())
        mInstant = this
        YcJetpack.init(this, UrlHelper.BASE_URL)
        HostProviderTest.init(this)
        HostProviderTest.mMsg = "appMsg"
        HostProviderTest2.init(this)
        YcPluginHostConstant.ChildZipPath.MODULE_1 = this.filesDir.path + File.separator + PluginHelper.sPluginZip
        YcPluginHostConstant.MANAGER_APK_PATH = this.filesDir.path + File.separator + PluginHelper.sPluginManagerName
        if (!YcPluginInit.isProcess(this, YcPluginInit.PLUGIN_PROCESS_NAME)) {
            PluginHelper.instance.init(this)
        }
        YcPluginInit.mInstance.init(mInstant, YcPluginHostConstant.MANAGER_APK_PATH)

    }
}